import openpyxl

ws = openpyxl.load_workbook(r"C:\Users\10352\Desktop\1.xlsx").worksheets[0]
# ws = openpyxl.load_workbook(r"C:\Users\zhang\Desktop\1.xlsx").worksheets[0]



wb1 = openpyxl.Workbook()
ws1 = wb1.worksheets[0]


ws1.cell(row=1, column=1, value="品号（格式要求：数值）")
ws1.cell(row=1, column=2, value="预测数量（格式要求：数值）")
ws1.cell(row=1, column=3, value="预测月份（格式要求：常规）")
a = 2
for i in range(2, ws.max_column + 1):
    for j in range(2, ws.max_row + 1):
        if (ws.cell(row=j, column=i).value is not None
                and ws.cell(row=j, column=i).value != ""
                and ws.cell(row=j, column=i).value != 0):
            ws1.cell(row=a, column=1, value=ws.cell(row=j, column=1).value)
            ws1.cell(row=a, column=2, value=ws.cell(row=j, column=i).value)
            ws1.cell(row=a, column=3, value=ws.cell(row=1, column=i).value)
            a += 1

wb1.save(r"C:\Users\10352\Desktop\销售预测导入模板.xlsx")
# wb1.save(r"C:\Users\zhang\Desktop\销售预测导入模板.xlsx")